define(function (require, exports, module) {
	var Form=require("Form");
	var SearchForm=function(target){
		this.target=target
	}
	SearchForm.prototype=new Form();
	
	SearchForm.prototype.init=function(){
		var self=this;
		this.element=$("#searchForm").get(0)
		$(this.element).bind("submit",function(event){
			var success=self.submitHandle(event)
			if(success){
				ht.loading.open();
			}
			return success;
		})
		
		$("#clearButton").unbind("click")
		$("#clearButton").bind("click",function(event){return self.clearButtonHandle(event);})
		
		$("#search").unbind("click")
		$("#search").bind("click",function(event){return self.searchButtonHandle(event);})
		
		if(typeof this.target!="undefined" && this.target!=""){
			this.loadRule("/data/"+this.target+"/searchFormRule.json",function(){self.updateRuleNames()});
		}
	}
	SearchForm.prototype.target="account"
	
		
		
		
		
	SearchForm.prototype.clearButtonHandle=function(event){
		this.clearSearchModule();
		return false;
	}
	SearchForm.prototype.clearSearchModule=function(){
		var objs=$("tr","#searchModule").each(function(){
				if($(this).is(":visible")){
					$(':input',this).not(':button, :submit, :reset').val('').removeAttr('checked').removeAttr('selected');
				}
			}
		)
		//清除easyui里表单项
		try{
			$(".datebox-f").datebox("setValue","");
		}catch(error){
			
		}
		return false;
	}
	
	SearchForm.prototype.searchButtonHandle=function(){
		return true;
	}
	//获得参数序列
	SearchForm.prototype.getSerializeArray=function(){
		var serializeArray=$("#searchForm").serializeArray()
		return serializeArray;
	}
	
	SearchForm.prototype.insertElement=function(element){
		var searchForm=document.getElementById("searchForm")
		searchForm.insertBefore(element,searchForm.firstChild);
	}
	module.exports = SearchForm;
});